<!doctype html>
<html lang="zh-cmn-Hans">
  <head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, shrink-to-fit=no"/>
    <meta name="renderer" content="webkit"/>
    <meta name="force-rendering" content="webkit"/>
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"/>
    <!-- MDUI CSS -->
    <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/mdui@1.0.2/dist/css/mdui.min.css"/>
 <style>
.k1 {
position: absolute;
left: 50%;
top: 50%;
transform: translate(-50%, -50%);
}

    </style>
    <title>Ourshare</title>
  </head>
  <body class="mdui-drawer-body-left mdui-theme-primary-indigo mdui-text-color-white" >
<div class="mdui-toolbar mdui-color-theme mdui-text-color-white">
<span class="mdui-btn mdui-btn-icon mdui-indigo" mdui-drawer="{target: '#drawer', swipe: true}">
      <i class="mdui-icon material-icons">menu</i>
    </span>
  <span class="mdui-typo-title">Ourshare</span>
  <div class="mdui-toolbar-spacer"></div>
</div>

<div class="mdui-drawer mdui-color-white" id="drawer">
    <ul class="mdui-list">
      <li class="mdui-list-item mdui-ripple">
        <i class="mdui-list-item-icon mdui-icon material-icons">&#xe88a;</i>
       <div class="mdui-list-item-content "> <a href="../index.php">首页</a></div>
      </li>
      <li class="mdui-list-item mdui-ripple mdui-list-item-active">
        <i class="mdui-list-item-icon mdui-icon material-icons">&#xe2c6;</i>
        <div class="mdui-list-item-content"><a href="../load.php">文件上传</a></div>
      </li>
      <li class="mdui-list-item mdui-ripple">
        <i class="mdui-list-item-icon mdui-icon material-icons">&#xe2c4;</i>
        <div class="mdui-list-item-content"><a href="../download.php">获取码下载</a></div>
      </li>

      <li class="mdui-subheader">其他</li>
      <li class="mdui-list-item mdui-ripple">
        <i class="mdui-list-item-icon mdui-icon material-icons">&#xe7fb;</i>
        <div class="mdui-list-item-content"><a href="../my.php">个人中心</a></div>
      </li>
      <li class="mdui-list-item mdui-ripple">
        <i class="mdui-list-item-icon mdui-icon material-icons">&#xe0da;</i>
        <div class="mdui-list-item-content"><a href="../admin">管理员后台</a></div>
      </li>
    </ul>
  </div>

  <div class="mdui-container k1"  style="margin:auto;text-align:center">
<div class=" mdui-text-color-theme mdui-typo-display-3">文件上传结果</div>
<div class="mdui-text-color-black mdui-typo ">
<?php
header ( "Content-type:text/html;charset=utf-8" );

if ((($_FILES["file"]["type"] == "text/html")|| ($_FILES["file"]["type"] == "image/jpeg")|| ($_FILES["file"]["type"] == "image/png")
|| ($_FILES["file"]["type"] == "text/plain")|| ($_FILES["file"]["type"] == "image/png"))&& ($_FILES["file"]["size"] < 1000000*$_COOKIE["vip"]))
  {
if ($_FILES["file"]["error"] > 0)
  {
  echo "<br />禁止的格式，无法保存" . $_FILES["file"]["error"] . "<br /><br />";
  }
else
  {

$json_string = file_get_contents('install_sql.json');
$dataxxx = json_decode($json_string, true);
$link=mysqli_connect($dataxxx[1],$dataxxx[2],$dataxxx[3]);//链接数据库
 $select=mysqli_select_db($link,$dataxxx[4]);//选择数据库
$str1="select key1 FROM `OurShareUrlSave` ORDER BY key1 DESC LIMIT 0,1 ;";
	  $pass1=mysqli_query($link,$str1);
$result1=mysqli_fetch_array($pass1);
$pass2=$result1[0]+1;
      move_uploaded_file($_FILES["file"]["tmp_name"],
      "upload/" . $_FILES["file"]["name"]);
$dr=$_SERVER['HTTP_HOST']. "/upload/".$_FILES["file"]["name"];
      $str="INSERT INTO `OurShareUrlSave`(`key1`, `www`) VALUES ("."\""."$pass2"."\"".","."\""."$dr"."\"".")";
	  $pass=mysqli_query($link,$str);

echo "获取码：".$pass2."<br /><br />";
  echo "文件名: " . $_FILES["file"]["name"] . "<br /><br />";
  echo "类型: " . $_FILES["file"]["type"] . "<br /><br />";
  echo "大小: " . ($_FILES["file"]["size"] / 1024) . " Kb<br /><br />";


      echo "保存位置: <br />" .$_SERVER['HTTP_HOST']. "/upload/".$_FILES["file"]["name"];
  }
  }else{
	  echo "没有文件或文件过大或格式错误，无法保存 ". "<br /><br />";
  }
?>
  </div>
  </div>

    <!-- MDUI JavaScript -->
    <script src="https://cdn.jsdelivr.net/npm/mdui@1.0.2/dist/js/mdui.min.js"></script>
  </body>
</html>